home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / cug190.zip / AS68.DOC < prev    next >
Text File  |  1985-11-15  |  44KB  |  1,776 lines

  1.  
  2.  
  3.                        as68 - 68000 Assembler, version 1.01
  4.  
  5.  
  6.                (c) copyright 1982 Steve Passe  all rights reserved
  7.  
  8.  
  9.  
  10.  
  11.  
  12.                            Table of Contents
  13.  
  14.  
  15.           Chapter 1 Introduction                                 1
  16.  
  17.           Chapter 2 Usage                                        5
  18.  
  19.           Chapter 3 Pseudo-ops                                   9
  20.  
  21.           Chapter 4 Mnemonics                                    12
  22.  
  23.           Chapter 5 Expressions                                  15
  24.  
  25.           Chapter 6 S File Format                                17
  26.  
  27.           Chapter 7 Error Messages                               19
  28.  
  29.           Chapter 8 Differences                                  23
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.           as68 Manual                                     Introduction
  39.           
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.                                     Chapter 1
  50.  
  51.                                   Introduction
  52.  
  53.  
  54.  
  55.  
  56.             The  as68  assembler is a disk to disk assembler  for  the
  57.           Motorola  68000  micrprocessor  chip.   Written   in  the  c
  58.           programming language, it may be used as a cross assembler on
  59.           any  machine  supporting c, or  as  a  native  assembler  if
  60.           compiled  with  a  c  that   produces  68000  output.   It's
  61.           directives and mnemonic  set  closely  follow  that  of  the
  62.           Motorola Resident Structured Assembler.
  63.  
  64.           
  65.  
  66.           Source Program
  67.  
  68.             The  input  to  the  assembler  is  an  ascii  text  file,
  69.           consisting of a series of statements written in the assembly
  70.           language.  Each statement consists of  one  or  more  fields
  71.           within a line. 
  72.  
  73.             The assembler is free format within each line, i.e.  there
  74.           is  no  need  to  start a specific field of a statement in a
  75.           particular  column.   Fields are separated from one  another
  76.           with whitespace (tabs or spaces). 
  77.  
  78.           
  79.  
  80.           Statements
  81.  
  82.             There are 3 basic statement types.  The most common  is an
  83.           assembly language instruction or mnemonic. It is  a  command
  84.           to the  assembler  to  produce  a  machine operation code to
  85.           carry out a specific  action.   The second type of statement
  86.           is  called an assembly directive  or  pseudo-op.  Pseudo-ops
  87.           tell  the assembler how to assemble the program.  The  third
  88.           statement  type  is  called  a comment. It is ignored by the
  89.           assembler,  it's  purpose being to allow the  programmer  to
  90.           insert descriptions of what  the  code  is  doing within the
  91.           text of the source program.  Comments may exist as the final
  92.           field of the other two statement types. 
  93.  
  94.  
  95.  
  96.                                        -1-
  97.           
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.           as68 Manual                                     Introduction
  105.           
  106.  
  107.  
  108.  
  109.  
  110.           
  111.  
  112.           Instruction Statements
  113.  
  114.             An instruction statement  consists  of  from  one  to four
  115.           fields:
  116.  
  117.           
  118.  
  119.           [label] <mnemonic> [operand] [comment]
  120.  
  121.             Label Field
  122.  
  123.             The first field, the label field, is optional.  It is used
  124.           to  create  a  symbolic  name  for  the  address of the code
  125.           generated by  the  following assembler mnemonic.  This label
  126.           is  stored  in  the  symbol  table  and any references to it
  127.           evaluate to the associated address.  The label field  may be
  128.           the  only  field  of a statement and  multiple,  label  only
  129.           fields  may  follow one another.  In all cases the  label(s)
  130.           will  evaluate  to the address of the first mnemonic  to  be
  131.           assembled after the label(s) is specified. 
  132.  
  133.             Labels are composed of alphanumeric  characters and may be
  134.           up  to  30 characters long.  All characters of a  label  are
  135.           significant,  as  is the case of alphabetic characters (i.e.
  136.           "Foo" is different  than  "foo").  The  first character of a
  137.           label  must  be  either  alphabetic  or  the  character  '.'
  138.           (period).   Following   characters   may  also  include  the
  139.           underscore (_), dollarsign ($), and the digits '0' thru '9'.
  140.  
  141.             Labels starting in any other than the first column must be
  142.           terminated  with a colon (:). Certain symbols  are  reserved
  143.           for  the  use of the assembler and thus may not be  used  as
  144.           labels.   These  include  "SP",  "USP",  "SR",  "CCR",  "A0"
  145.           through "A7" and "D0" through "D7".
  146.  
  147.             Mnemonic Field
  148.  
  149.             The  second  field is the mnemonic or assembly instruction
  150.           field.  It will always be  present  in a statement except in
  151.           the  case  of a label only statement (label only  statements
  152.           might more properly be  described as assembler directives). 
  153.           If  the  line  is  unlabeled  the  mnemonic  field  must  be
  154.           preceeded by whitespace. 
  155.  
  156.             A  mnemonic  will consist of from 3 to 5 ascii characters,
  157.           the  case of  which  is  not  significant.   This  assembler
  158.           recognizes  the  standard  Motorola  instruction  set.   The
  159.  
  160.  
  161.  
  162.                                        -2-
  163.           
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.           as68 Manual                                     Introduction
  171.           
  172.  
  173.  
  174.  
  175.           complete mnemonic instruction set is described in chapter 4,
  176.           "Mnemonics". Many  68000  instructions may work on different
  177.           data sizes.  The desired data size is specified by appending
  178.           a length modifier or data size code to the mnemonic.  A '.b'
  179.           extension  specifies a data size of byte (8 bits) while '.l'
  180.           will cause the data size to be  a  long  word (32 bits).  No
  181.           extension will cause the data size to be a word  (16 bits). 
  182.           A  '.w'  extension  may  be used for  data  sizes  of  word,
  183.           although  this  size  is  the  default  and as such the '.w'
  184.           modifier is unnecessary. 
  185.  
  186.             Operand Field
  187.  
  188.             The operand field is necessary  only  for those statements
  189.           whose mnemonic requires  an operand(s).  It will contain one
  190.           or two operands.  When two operands are present they must be
  191.           separated  with  a  comma  (no  whitespace  allowed  between
  192.           operands).  The first of two  operands  is refered to as the
  193.           source operand while the second is the destination operand. 
  194.  
  195.             Comment Field
  196.  
  197.             The comment field is optional  and  consists  of  all text
  198.           following the above fields. 
  199.  
  200.           
  201.  
  202.           Directives
  203.  
  204.             Label Field
  205.  
  206.             Labels used  with  directive statements follow the general
  207.           rules   of  those  used  in  assembly  statements  with  one
  208.           important exception:    they  may  only  be  used  with  the
  209.           following directives:
  210.  
  211.             1.  EQU
  212.  
  213.             2.  SET
  214.  
  215.             3.  DC
  216.  
  217.             4.  DS
  218.  
  219.             5.  MACRO (unimplimented in ver.  1.xx)
  220.  
  221.             Directive Field
  222.  
  223.             The  directive  field  contains  an   instruction  to  the
  224.           assembler as to how the program should  be  assembled.  This
  225.  
  226.  
  227.  
  228.                                        -3-
  229.           
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.           as68 Manual                                     Introduction
  237.           
  238.  
  239.  
  240.  
  241.           includes such things as the base  address  of  the  program,
  242.           setting  of  symbol  values,  allocation of  program  memory
  243.           storage,  conditional  assembly,  etc.  The complete list of
  244.           available  assembly  directions   is  given  in  chapter  3,
  245.           "Pseudo-ops".
  246.  
  247.             Operand Field
  248.  
  249.             The operand field of a directive statement will consist of
  250.           zero  or  more  operands,  as  needed  by  the pseudo-op  in
  251.           question.  Multiple operands are separated with a comma (,).
  252.           No whitespace